import config from "@/config";
import http from "@/utils/request";
import qs from "qs";

export default {
	token: {
		url: `${config.API_URL}/token`,
		name: "登录获取TOKEN",
		post: async function (data = {}) {
			return await http.post(this.url, data);
		},
	},
	token2: {
		url: `${config.API_URL}/login/username`,
		name: "登录获取TOKEN",
		post: async function (params) {
			return await http.post(this.url, qs.stringify(params), {
					headers: {
						"Content-Type": "application/x-www-form-urlencoded"
					},
			});
		},
	},
	login: {
		url: `${config.API_URL}/login/login`,
		name: "登录",
		post: async function (params) {
			return await http.post(this.url, params);
		},
	},
	logout: {
		url: `${config.API_URL}/login/logout`,
		name: "登出",
		post: async function (params) {
			return await http.post(this.url, params);
		},
	},
	updatePassword: {
		url: `${config.API_URL}/login/updatePassword`,
		name: "修改密码",
		get: async function (params) {
			return await http.get(this.url, params);
		},
	},
	resetPassword: {
		url: `${config.API_URL}/login/resetPassword`,
		name: "充值密码",
		get: async function (params) {
			return await http.get(this.url, params);
		},
	},
};
